﻿
@{
    ViewBag.Title = "重要通知";
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>中国铁塔油机管理系统-@ViewBag.Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="~/Content/css/frozenui.css">
    <link rel="stylesheet" href="~/Content/css/style.css">
    <link href="~/Content/css/weui.1.1.2min.css" rel="stylesheet" />
    @*<link href="~/Content/css/jquery-weui.css" rel="stylesheet" />*@
    @*<script src="~/Content/script/jquery-1.8.3.min.js"></script>*@
    <script src="~/Content/script/jquery-3.3.1.min.js"></script>
    <script src="~/Content/script/jweixin-1.4.0.js"></script>
    <script src="~/Content/script/jquery-weui.min.js"></script>
    <script src="~/Content/script/weui1.1.3.min.js"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        html, body {
            position: relative;
            height: 100%;
        }

        li, a {
            list-style: none;
            text-decoration: none;
        }

        #seacher {
            display: flex;
            justify-content: space-between;
            padding: 6px 8px;
            background: #E9EDF0;
            height: 1.32rem;
        }

            #seacher input {
                margin-right: 10px;
                width: 80%;
                background: #fff;
                border: none;
                border-radius: 5px;
                outline: none;
                box-sizing: border-box;
                padding: 0 10px;
                text-align: center;
                font-size: 0.6rem;
            }

            #seacher button {
                width: 20%;
                border-radius: 4.96px;
                border: none;
                background: #2ECA70;
                color: #fff;
                outline: none;
                line-height: 1.32rem;
                font-size: 0.6rem;
            }

                #seacher button img {
                    width: 0.7rem;
                    vertical-align: text-bottom;
                }

        #timeRadio {
            display: flex;
            padding: 2px 8px;
            height: 1.32rem;
        }

            #timeRadio .ui-radio {
                margin-right: 0.72rem;
                line-height: 1.32rem;
                font-size: 0.65rem;
                color: #424242;
                font-weight: bold;
            }

                #timeRadio .ui-radio input {
                    width: 1rem;
                    height: 1rem;
                    top: -2px;
                    margin-right: 5px;
                }

                    #timeRadio .ui-radio input:before {
                        width: 0.9rem;
                        height: 0.9rem;
                        background: #fff;
                        left: 0.05rem;
                        top: 0.05rem;
                        border-radius: 0.5rem;
                    }

                    #timeRadio .ui-radio input:checked:after {
                        width: 0.5rem;
                        height: 0.5rem;
                        background: #2ECA70;
                        border: 1px solid #2ECA70;
                        border-radius: 0.4rem;
                        left: 0.25rem;
                        top: 0.25rem;
                    }

        #content {
            position: absolute;
            top: 3.28rem;
            left: 0;
            right: 0;
            bottom: 0;
        }

            #content ul li {
                margin-bottom: 2px;
                background: #fff;
                padding: 10px 15px;
                box-sizing: border-box;
            }

                #content ul li h2 {
                    line-height: 1.4rem;
                    font-size: 0.65rem;
                    font-weight: 800;
                    color: #3B3B3B;
                    letter-spacing: 1px;
                }

                #content ul li div {
                    margin-top: 5px;
                    color: #6D6D6D;
                    display: flex;
                    justify-content: space-between;
                    font-size: 0.5rem;
                }
    </style>
</head>
<body>

    <div id="seacher">
        <input id="Msg" type="text" placeholder="请输入标题查询">
        <button id="Search"><img src="~/Content/image/search (1).png" alt="">&nbsp;搜索</button>
    </div>
    <div id="timeRadio">

        <label class="ui-radio" for="radio">
            <input type="radio" name="radio" value="0" />全部
        </label>

        <label class="ui-radio" for="radio">
            <input type="radio" checked="" name="radio" value="7" />一周
        </label>

        <label class="ui-radio" for="radio">
            <input type="radio" name="radio" value="15" />半月
        </label>

        <label class="ui-radio" for="radio">
            <input type="radio" name="radio" value="30" />本月
        </label>
    </div>
    <div id="content">
        <ul id="list">
        </ul>
      

    </div>

    <script>
      (function(designWidth, maxWidth) {
          var html = document.getElementsByTagName("html")[0];
          var tid;
          function refreshRem() {
            var width = html.getBoundingClientRect().width;
            console.log(width / 15)
            html.style.fontSize = width / 15 + "px"
          }
          window.addEventListener("resize", function() {
            clearTimeout(tid); //防止执行两次
            tid = setTimeout(refreshRem, 300);
          }, false);
          refreshRem();
      })();
    </script>
    <script>
        var radioValue = 7;//全局变量，日期事件
        GetImportantList(7, '');//初始化，默认本周
        setInterval(function () {
            GetImportantList(7, '');//默认本周
        }, 60 * 1000 * 5);//5分钟实时刷新

        var datalist = "";
        //获取重要信息记录
        function GetImportantList(times, paraStr) {
            //ajax参数
            var paramdata = {
                times: times,
                paraStr: paraStr
            };
            $.ajax({
                url: '/api/Info/GetImportantList',
                type: 'get',
                data: paramdata,
                beforeSend: function () {
                    $.showLoading("加载中...");
                },
                error: function (data) {
                    $.hideLoading();
                    $.alert(eval(data), "提示");
                },
                success: function (data) {
                    $.hideLoading();
                    //var result = JSON.parse(data);
                    var result = data.Data;
                    if (result.Code == 1) {
                        if (result.Result != "[]") {
                            var Info = JSON.parse(result.Result);
                            Info.forEach(function (d, i) {
                                var executionDate = d.CreateTime.replace('T', ' ').replace(/.\d+$/, ' ');//时间处理
                                datalist += "<li><a href='/Information/ImportantView?WXEditorId=" + d.WXEditorId + "'><h2>" + d.EditorTitle + "</h2><div><span>" + d.CreateName + "</span><span>" + executionDate + "</span></div></a></li>";

                            });
                            $("#list").html(datalist);
                            datalist = "";
                        } else {
                            $("#list").html("<li style='width: 100%;height: 60px;display: block;line-height: 45px;text-align: center;color:#757575;font-size:0.7rem;'>0条记录</li>");
                        }
                    } else {
                        $.alert(result.Result, "提示");
                    }
                }
            })
        }

        //radio点击事件
        $(':radio').click(function () {
            radioValue = $(this).val()  //获取选中的radio的值
            GetImportantList(radioValue, '');
        });

        //搜索
        $("#Search").click(function () {
            var Msg = $("#Msg").val().trim();
            GetImportantList(radioValue, Msg);
        });

    </script>
</body>
</html>
